#include "Const.h"

.code32
.text
.extern InitOriginOS
.extern Start

_start:
    # this entry executes from call intruction, 
    # so it will push return address automatically.
    # before calling function,
    # params should be pushed from right to left.
    # ESP register points to return address.
    push 4(%esp)
    call InitOriginOS

	// 重新加载GDT
	jmp $GDT_CODE_SELECTOR, $gdt_reload

gdt_reload:
	mov $GDT_DATA_SELECTOR, %ax		// 16为数据段选择子
	mov %ax, %ds
    mov %ax, %ss
    mov %ax, %es
    mov %ax, %fs
    mov %ax, %gs

	mov $(stack + KERNEL_STACK_SIZE), %esp

    jmp Start

	.bss
.comm stack, KERNEL_STACK_SIZE 